package cn.wolfcode.service.impl;

import cn.wolfcode.domain.Dept;
import cn.wolfcode.mapper.DeptMapper;
import cn.wolfcode.service.DeptService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;
@Slf4j
@Service
public class DeptServiceImpl implements DeptService {
    @Autowired
    private DeptMapper deptMapper;
    @Override
    public List<Dept> selAll() {
        log.info("执行部门查询的业务层");
        return deptMapper.selAll();
    }

    @Override
    public void delById(Long id) {
        deptMapper.delById(id);
    }

    @Override
    public void add(Dept dept) {
        dept.setUpdateTime(new Date());
        dept.setCreateTime(new Date());
        deptMapper.add(dept);
    }

    @Override
    public Dept selById(Long id) {
        return deptMapper.selById(id);
    }

    @Override
    public void updateId(Dept dept) {
        dept.setUpdateTime(new Date());
        deptMapper.updateId(dept);
    }
}
